package com.example.njupt.uis.mvp;

import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.njupt.R;
import com.example.njupt.base.BaseMvpActivity;
import com.example.njupt.constant.ARouteConstance;
import com.example.njupt.okhttp.entity.MusicEntity;
import com.example.njupt.views.automatic.AutomaticRecyclerView;

import butterknife.BindView;

/**
 * Author:      mwang
 * Create Date: Created in 2021/4/26 11:42
 * Update Date:
 * Modified By:
 * Description:
 */
@Route(path = ARouteConstance.ACTIVITY_MVP)
public class MvpActivity extends BaseMvpActivity<MvpPresenter> implements IMvpView{
    @BindView(R.id.tv_mvp)
    TextView tvMap;
    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.arv_content)
    AutomaticRecyclerView arvContent;
    @Override
    protected MvpPresenter createPresenter() {
        return new MvpPresenter();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_mvp;
    }

    @Override
    protected void initView() {
        getToolbarHelper().enableBack();
        getToolbarHelper().setTitle("MVP模式");
    }

    @Override
    protected void initData() {
        String format = "https://node.kg.qq.com/play?s=YaCv8EYfJunVWYcH";
        mPresenter.getMvp(format);
    }

    @Override
    protected void initListener() {

    }

    @Override
    public void onSuccess(MusicEntity result) {
        tvContent.setText(result.getPlayurl());
        tvContent.setTextColor(getApplication().getColor(R.color.main_blue));
    }

    @Override
    public void onError() {

    }
}
